import Vapor
//export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;export ALL_PROXY=socks5://127.0.0.1:1080
//xcodebuild -resolvePackageDependencies -scmProvider system
func routes(_ app: Application) throws {
    app.get { req async -> Response in
        let path = req.application.directory.publicDirectory.appending("index.html")
        do {
            let html = try String(contentsOf: URL(fileURLWithPath: path), encoding: .utf8)
            let response = Response(status: .ok)
            response.headers.contentType = .html
            response.body = .init(string: html)
            return response
        } catch {
            return Response.init(status: .internalServerError)
        }
    }
    app.get("privacy.html") { req async -> Response in
        let response = Response(status: .ok)
        response.headers.contentType = .html
        response.body = .init(string: String.privacy)
        return response
    }
    app.get("agreement.html") { req async -> Response in
        let response = Response(status: .ok)
        response.headers.contentType = .html
        response.body = .init(string: String.agreement)
        return response
    }
    app.get("support.html") { req async -> Response in
        let response = Response(status: .ok)
        response.headers.contentType = .html
        response.body = .init(string: String.support)
        return response
    }
    try app.routes.register(collection: Group())
    try app.routes.register(collection: Config())
    try app.routes.register(collection: Location())
    try app.routes.register(collection: User())
    try app.routes.register(collection: Events())
    try app.routes.register(collection: FeedBack())
    try app.routes.register(collection: FileUpload())
    try app.routes.register(collection: APNSController())
    try app.routes.register(collection: AppStoreNotification())
}
